package com.yx.elastic.elasticcm.service.impl;

import com.alibaba.fastjson.JSONObject;
import com.yx.elastic.elasticcm.base.ISearchException;
import com.yx.elastic.elasticcm.base.impl.ISearchImpl;
import com.yx.elastic.elasticcm.entity.ElasAnalyzer;
import com.yx.elastic.elasticcm.service.AnalyzerService;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by chenzp on 18-7-31.
 */
@Service
public class AnalyzerServiceImpl extends ISearchImpl<ElasAnalyzer> implements AnalyzerService{




    @Override
    public List<JSONObject> list() {
        return null;
    }

    @Override
    public void create() {

        try {
            this.deleteBatchById(new ArrayList<>());
        } catch (ISearchException e) {
            e.printStackTrace();
        }
//        if (StringUtils.isNullAndEmpty(index)) {
//            index = ".analyzer-cm";
//        }
//
//        if (StringUtils.isNullAndEmpty(type)) {
//            type = "doc";
//        }
//
//
//        try {
//
//            CreateIndexRequest request = new CreateIndexRequest(index);//创建索引
//
//            XContentBuilder builder = JsonXContent.contentBuilder()
//                    .startObject()
//                        .startObject(type)
//                            .startObject("properties")
//                                .startObject("message")
//                                    .field("type","text")
//                                .endObject()
//                            .endObject()
//                        .endObject()
//                    .endObject();
//            request.mapping(type, builder, XContentType.JSON);
//
//
//
//            request.index();
//
//        } catch (IOException e) {
//            e.printStackTrace();
//        }




    }



}
